export const filterCitySelect = (data = []) => {
  // 声明一个空数组用来存储地区对象
  const listCity = [];

  // 遍历员工列表数据
  data.forEach((employee) => {
    // 创建地区对象
    const area = {
      areaId: employee.areaId,
      areaName: employee.areaName,
      cityId: employee.cityId,
      cityName: employee.cityName,
    };

    // 判断地区对象是否已存在于数组中
    const isExist = listCity.some(
      (item) =>
        item.areaId === area.areaId &&
        item.areaName === area.areaName &&
        item.cityId === area.cityId &&
        item.cityName === area.cityName
    );

    // 如果地区对象不存在于数组中，则添加到数组中
    if (!isExist) {
      listCity.push(area);
    }
  });

  return listCity;
};
